#include<iostream>
#include<vector>
#include<string>
#include<cmath>
#include<algorithm>
using namespace std;

class Solution {
public:
    vector<bool> prefixesDivBy5(vector<int>& A) {
        int temp = 0;
        vector<bool> result;
        for(int i = 0;i<A.size();++i){
            if(A[i]==1){
                temp = (temp*2)%5 + 2;
            }
            else{
                temp = (temp*2)%5;
            }
            bool sonResult = (temp%5==0? true:false);
            result.push_back(sonResult);
        }
        return result;
    }
};

int main(){
    Solution S;
    vector<int> V = {0,1,1,1,1,1};
    vector<bool> result = S.prefixesDivBy5(V);
    return 0;
}